package io;

import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;

public class IODemo15 {
    public static void main(String[] args) {
        // 写文件
        try(Writer writer = new FileWriter("./aaa/bbb/b.txt")){
            String s = "春眠不觉晓，处处闻啼鸟。";
            writer.write(s);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        // 在文件中追加内容
        try(Writer writer = new FileWriter("./aaa/bbb/b.txt", true)){
            String s = "夜来风雨声，花落知多少。";
            writer.write(s);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
